package info.johnwheeler.gaestorage.core;

import java.util.Map;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.DAOBase;

public class CountyDao extends DAOBase {

    static {
        ObjectifyService.register(County.class);
    }

    public County save(County county) {
        ofy().put(county);
        return county;
    }
    
    public County findById(Long id) {
        Key<County> key = new Key<County>(County.class, id);
        return ofy().get(key);
    }

    public Map findAll() {
    	Objectify ofy = ObjectifyService.begin();
    	Iterable allKeys = ofy.query(County.class).fetchKeys();
    	Map fetched3 = ofy.get(County.class, allKeys);
        return fetched3; 
    }

}
